<template>
    <view style="width: 100vw;height:100vh;">
        <u-navbar title="编辑分类"></u-navbar>
        <div class="form-box">
            <u-form :model="form" ref="form" label-position="top">
                <u-form-item label="分类名称" prop="name"><u-input v-model="form.name" /></u-form-item>
            </u-form>
        </div>
        <div class="bottom-btn">
            <u-button class="btn" type="error" @click="remove">删除</u-button>
            <u-button class="btn" type="primary" @click="submit">提交</u-button>
        </div>
    </view>
</template>
<script lang="ts" setup>
import {
	    onLoad
	  } from "@dcloudio/uni-app";
import { ref, reactive, onMounted } from 'vue';
import config from '../../config/index'
const form = ref({
    id: '',
    name: ''
})
const id = ref()

onLoad(async (options) =>{
    id.value = options.id;
    
})

onMounted(async ()=>{
    const resp =  await uni.request({
        url: `${config.baseUrl}/category/detail/${id.value}`,
        method: 'get'
    })
    form.value = resp.data.data;
    console.log(form.value)
})

</script>
<style lang="scss" scoped>
.home-contirner {
    margin: 10rpx;

}

.form-box {
    margin: 10px;
}

.bottom-btn {
    position: absolute;
    bottom: 0px;
    width: 100%;
    padding: 10rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10rpx;

    .btn {
        width: 50vw;
    }
}
</style>